package model

import (
	"fmt"
)

type person struct {
	name string
	age  int
	sal  float64
}

func GetPerson(name string) *person {
	return &person{
		name: name,
	}
}

func (p *person) SetAge(age int) {
	if age <= 18 {
		fmt.Println("年龄太小")
	} else {
		p.age = age
	}
}

func (p *person) SetSal(sal float64) {
	if sal < 0 {
		fmt.Println("薪水错误")
	} else {
		p.sal = sal
	}
}

func (p *person) GetAge() int {
	return p.age
}

func (p *person) GetSal() float64 {
	return p.sal
}
